package classes;

import java.util.Arrays;

/**
 *	Basic orthogonal system coordinates class 
 */
public class Coordinate {

	private int x;
	private int y;
	
	public Coordinate() {
		this.x = -1;
		this.y = -1;
	}
	
	public Coordinate(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}
	
	
	@Override
	public boolean equals(Object obj) {
		if (obj == null)
			return false;
		
		if (!(obj instanceof Coordinate))
			return false;
		
		Coordinate other = (Coordinate) obj;
		
		return other.getX() == x && other.getY() == y;
	}
	
	@Override
	public int hashCode() {
		int[] hash = {x, y};
		return Arrays.hashCode(hash);
	}
}
